<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<html>
<head>
    <title>易买网 - 首页</title>
    <link type="text/css" rel="stylesheet" href="/css/style.css"/>
    <script type="text/javascript" src="/scripts/function.js"></script>
</head>

<body>
<%@ include file="/WEB-INF/common/head.jsp" %>
<div id="position" class="wrap">
    您现在的位置：<a href="/index">易买网</a> &gt; 在线留言
</div>
<div id="main" class="wrap">
    <%@ include file="/WEB-INF/common/left.jsp" %>
    <div class="main">
        <div class="guestbook">
            <h2>全部留言</h2>
            <ul>
                <c:forEach items="${commentPage.records}" var="comment">
                    <li>
                        <dl>
                            <dt>${comment.content}</dt>
                            <dd class="author">网友：${comment.nickName} <span class="timer">
                                <fmt:formatDate type="both" value="${comment.replyTime}"/></span>
                            </dd>
                            <dd>${comment.reply}</dd>
                        </dl>
                    </li>
                </c:forEach>
            </ul>
            <div class="clear"></div>
            <div class="pager">
                <ul class="clearfix">
                    <li><a href="/comment/info?current=${commentPage.hasPrevious()?commentPage.current-1:1}">上一页</a>
                    </li>
                    <c:forEach var="index" begin="1" end="${totalPage}" step="1">
                        <li class="current"><a href="/comment/info?current=${index}">${index}</a></li>
                    </c:forEach>
                    <li>
                        <a href="/comment/info?current=${commentPage.hasNext()?commentPage.current+1:totalPage}">下一页</a>
                    </li>
                </ul>
            </div>

        </div>
        <div id="reply-box">
            <form id="regForm" action="/comment/add" method="post" onsubmit="return checkForm(this)">
                <table>
                    <tr>
                        <td class="field">昵称：</td>
                        <td><input class="text" type="text" name="nickName"
                                   value="${sessionScope.USER_IN_SESSION.userName}" readonly="readonly"/></td>
                    </tr>
                    <tr>
                        <td class="field">留言内容：</td>
                        <td><textarea name="content" onfocus="FocusItem(this)"
                                      onblur="CheckItem(this);"></textarea><span></span></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><label class="ui-blue"><input type="submit" name="submit" value="提交留言"/></label></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<div class="clear"></div>
</div>
<%@ include file="/WEB-INF/common/footer.jsp" %>
</body>
</html>
